<!DOCTYPE html>
<html lang="en">

<include file="CommonSidebar:common-head"/>
<link rel="stylesheet" href="__ROOT__/Application/Admin/Public/css/common.css">
<link href="__ROOT__/Application/Admin/Public/css/jquery.datetimepicker.css" rel="stylesheet">
<body>

<div id="wrapper">

    <!-- Navigation -->
    <include file="CommonSidebar:common-navbar"/>

    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">有赞订单列表</h1>
            </div>
            <div class="alert alert-success" role="alert">
                <a href="{:U('/ERPAPI/LeadIn')}"
                   class="alert-link btn btn-default">一键导入</a>
            </div>
            <div class="alert alert-success" role="alert">
                <a href="http://localhost:8082/ERP/index.php/ERPAPI/index?access_token={$access_token}&mallid={:OutS('mallid')}&mallname={:OutS('mallname')}"
                  target="_blank"
                   class="alert-link btn btn-default">跳转本地</a>
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        订单
                    </div>
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="dataTable_wrapper">
                            <table class="table table-striped table-bordered table-hover" id="dataTables-example">
                                <thead>
                                <tr>
                                    <th width="6%" style="text-align:center">交易编号</th>
                                    <th width="25%" style=" text-align:center">商品</th>
                                    <th width="7%" style=" text-align:center">商品金额</th>
                                    <th width="7%" style=" text-align:center">应付金额</th>
                                    <th width="8%" style=" text-align:center">联系人</th>
                                    <th width="11%" style="text-align:center">收货地址</th>
                                    <th width="8%" style="text-align:center">收货人手机</th>
                                    <th width="8%" style="text-align:center">创建时间</th>
                                    <th width="7%" style="text-align:center">状态</th>
                                    <th width="5%" style="text-align:center">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <foreach name="DATA" item="v" key="k">
                                    <tr class="odd gradeX">
                                        <td>{$v.tid}</td>
                                        <td><?php
                                             foreach($v['goodsdata'] as $k1 => $v1){
                                            if($v1['CODE']){
                                                echo ("<label style='color: #00d6b2'>");
                                                echo $v1['CODE'];
                                                echo "</label>";
                                            }else{
                                                 echo "<label style='color: red'>";
                                                echo "<a href="."GETCODEINDEX?is=1&aa="."$k"."&bb=".$k1." >未对应内码(点击导入)</a>";
                                                echo '</label>';
                                            }

                                            echo '商品标题：'.$v1['title']."\n||\n";
                                            echo '商品规格：'.$v1['sku_properties_name']."\n||\n";
                                            echo   $v1['price'] .'*'. $v1['num'] .'=' .$v1['price'] * $v1['num'].'元';
                                            if($k1 < count($v['goodsdata']) -1){
                                            echo'<hr>';
                                            }
                                            }
                                            ?>
                                        </td>
                                        <td>{$v.total_fee}</td>
                                        <td>{$v.payment}</td>
                                        <td>{$v.receiver_name}</td>
                                        <td>
                                            {$v.receiver_state}--{$v.receiver_city}--{$v.receiver_district}--{$v.receiver_address}
                                            <if condition="$v['YD_ERP_CODE']">
                                                <label style="color: #00d6b2">{$v['YD_ERP_CODE']}</label>
                                            <else/>
                                                <label style="color: red">
                                                    <a href="{:U('/ERPAPI/GETYDCODEINDEX')}?buyer_id={$v.buyer_id}&CKDZ={$v.receiver_state}{$v.receiver_city}{$v.receiver_district}{$v.receiver_address}">未对应药店内码（点击导入）</a>
                                                </label>
                                            </if>
                                        </td>
                                        <td>{$v.receiver_mobile}</td>
                                        <td>{$v.created}</td>
                                        <td>{$v.status}</td>
                                        <td>
                                            <if condition="$v.red == 0">
                                                <lable style="color: #00d6b2">可导入</lable>
                                                <else/>
                                                <lable style="color: red">内码未完善</lable>
                                            </if>
                                        </td>
                                    </tr>
                                </foreach>
                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /#page-wrapper -->

</div>
<!-- /#wrapper -->


<include file="CommonSidebar:common-script"/>
<script src="__ROOT__/Application/Admin/Public/js/jquery.datetimepicker.js"></script>
<!-- DataTables JavaScript -->
<script src="__ROOT__/Application/Admin/Public/bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="__ROOT__/Application/Admin/Public/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="__ROOT__/Application/Admin/Public/dist/js/sb-admin-2.js"></script>
<!-- Page-Level Demo Scripts - Tables - Use for reference -->
<script>
    $(document).ready(function () {
        $('#dataTables-example').DataTable({
            responsive: true
        });
    });
</script>
<script type="text/javascript">
    <!--日期插件-->
    $('.datetimepicker_mask').datetimepicker({
        lang: 'ch',
        mask: '9999-19-39',
        format: 'Y-m-d',
        timepicker: false,    //关闭时间选项
        yearStart: 2000,     //设置最小年份
        yearEnd: 3050,        //设置最大年份
        todayButton: true,    //关闭选择今天按钮
        autoclose: true
    });

</script>
</body>

</html>
